package com.evil.common.application.dto.judge;

import cn.hutool.core.bean.BeanUtil;
import com.evil.common.application.enums.judge.JudgeSignEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 且条件实体
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class JudgeAnd extends Judge {

    public static String sign = " && ";

    public JudgeAnd() {
    }

    public JudgeAnd(Long controlId, String controlCode, JudgeSignEnum judgeSignEnum, String... value) {
        super(controlId, controlCode, judgeSignEnum, value);
    }

    public JudgeAnd copy() {
        return BeanUtil.copyProperties(this, JudgeAnd.class);
    }

    public static List<JudgeAnd> copy(Collection<JudgeAnd> ands) {
        return ands.stream().map(e -> e.copy()).collect(Collectors.toList());
    }
}
